package com.zhm.demo.controller.req;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@Data
public class EmqxHookSubscribeCheckReq {

    public static final String EVENT="client.check_authz_complete";

    /*
    {"username":"admin","topic":"/ota/device/upgrade/k0ekpKNA55m/330022320240308","timestamp":1712657157436,"result":"allow","peerhost":"10.101.0.232","node":"emqx@127.0.0.1","metadata":{"rule_id":"test-wh_WH_D"},"event":"client.check_authz_complete","clientid":"330022320240308","authz_source":"file","action":"subscribe"}
     */

    @JsonProperty("username")
    private String username;
    @JsonProperty("topic")
    private String topic;
    @JsonProperty("timestamp")
    private Long timestamp;
    @JsonProperty("result")
    private String result;
    @JsonProperty("peerhost")
    private String peerhost;
    @JsonProperty("node")
    private String node;
    @JsonProperty("metadata")
    private MetadataDTO metadata;
    @JsonProperty("event")
    private String event;
    @JsonProperty("clientid")
    private String clientid;
    @JsonProperty("authz_source")
    private String authzSource;
    @JsonProperty("action")
    private String action;

    @NoArgsConstructor
    @Data
    public static class MetadataDTO {
        @JsonProperty("rule_id")
        private String ruleId;
    }
}
